export const getFileIcon = (v, isImgIcon = false) => {
    if (!v) {
        return "";
    }
    if (v.isFolder) {
        return "/static/icon/file-folder.png";
    }
    let url = "";
    if (!v.type) {
        url = "/static/icon/file-unknown.png";
    } else if (v.type.indexOf("image") >= 0) {
        if (isImgIcon) {
            url = "/static/icon/file-image.png";
        } else {
            url = v.url;
        }
    } else if (v.type.indexOf("video") >= 0) {
        url = "/static/icon/file-video.png";
    } else if (v.type.indexOf("audio") >= 0) {
        url = "/static/icon/file-audio.png";
    } else if (v.type.indexOf("pdf") >= 0) {
        url = "/static/icon/file-pdf.png";
    } else if (v.type.indexOf("word") >= 0) {
        url = "/static/icon/file-word.png";
    } else if (
        v.type.indexOf("sheet") >= 0 ||
        v.fkey.indexOf(".xlsx") >= 0 ||
        v.fkey.indexOf(".xls") >= 0
    ) {
        url = "/static/icon/file-excel.png";
    } else if (v.type.indexOf("presentation") >= 0) {
        url = "/static/icon/file-ppt.png";
    } else if (
        v.type.indexOf("zip") >= 0 ||
        v.type.indexOf("rar") >= 0 ||
        v.type.indexOf("7z") >= 0
    ) {
        url = "/static/icon/file-zip.png";
    } else if (v.type.indexOf("text") >= 0 || v.type.indexOf("octet") >= 0) {
        url = "/static/icon/file-text.png";
    } else {
        url = "/static/icon/file-unknown.png";
    }
    return url;
}